package com.smbms.controller;

import java.io.File;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

@Controller
public class UploadController {

	private final Logger log= LoggerFactory.getLogger(getClass());			
	
	@RequestMapping("/upload")
	public String upload(MultipartFile[] file){
		
		for (MultipartFile tempFile : file) {
			if(tempFile != null){
				//保存文件
				
				File saveFile = new File("E:\\smbmsFiles\\"+tempFile.getOriginalFilename()); 
				
				try {
					tempFile.transferTo(saveFile);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}
		
		
		return "upload_res";
	}
}
